﻿using System.Management.Automation;

namespace Nivot.PowerShell.WindowsMobile.Commands
{
    [Cmdlet(VerbsCommon.Get, "WMMemoryInfo")]
    public class GetWMMemoryInfoCommand : WMCommandBase
    {
        protected override void EndProcessing()
        {
            var info = new PSObject();
            info.Properties.Add(new PSNoteProperty("MemoryLoad", Device.MemoryStatus.MemoryLoad /*+ "%"*/));

            info.Properties.Add(new PSNoteProperty("AvailPhysical", Device.MemoryStatus.AvailPhysical));
            info.Properties.Add(new PSNoteProperty("TotalPhysical", Device.MemoryStatus.TotalPhysical));

            info.Properties.Add(new PSNoteProperty("AvailVirtual", Device.MemoryStatus.AvailableVirtual));
            info.Properties.Add(new PSNoteProperty("TotalVirtual", Device.MemoryStatus.TotalVirtual));

            info.Properties.Add(new PSNoteProperty("AvailPageFile", Device.MemoryStatus.AvailablePageFile));
            info.Properties.Add(new PSNoteProperty("TotalPageFile", Device.MemoryStatus.TotalPageFile));
            info.TypeNames[0] = "WMMemoryInfo";
            WriteObject(info);
        }
    }
}